<template>
    <div class="order-components-container">
        <ul class="common-order-list" v-if="listData.length > 0">
            <li @click="jumpOrderDetail(item)" v-for="(item, index) in listData" :key="index">
                <div class="common-order-info-list">
                    <div class="common-order-info-list-top">
                        <div class="common-order-img">
                            <img :src="item.smallPic" alt="">
                        </div>
                        <div class="common-order-info-details">
                            <div class="common-order-info-detail-item-other">
                                <p>{{item.productName}}({{item.farmName}}）</p>
                            </div>
                            <div class="common-order-info-detail-item">
                                <span>养殖地：{{item.cattleAddress}}</span>
                                <span>牧场：{{item.farmName}}</span>
                            </div>
                            <div class="common-order-info-detail-item">
                                <span>重量：{{item.productWeight}}{{item.productWeightUnit}}</span>
                                <span>单价：{{item.salesPrice}}{{item.salesPriceUnit}}</span>
                            </div>
                            <div class="common-order-info-detail-item-one">
                                <p>剩余交货期：<span class="color-primary">{{item.deliveryMonth}}</span>个月</p>
                                <p><span class="color-yellow">{{item.totalPrice}}</span>{{item.productPriceUnit}}</p>
                            </div>
                        </div>
                    </div>
                    <div class="common-order-info-list-bottom">
                        <p>
                            供货数量：{{item.supplyNum}}头
                        </p>
                        <p>
                            合计：{{item.payMoney}}元
                        </p>
                    </div>
                </div>
                <div class="common-order-info-bottom">
                    <van-button round class="u-bg-gradient-light order-status-btn">{{item.statusValue}}</van-button>
                    <!-- <span class="order-status-text color-primary" v-if="item.state == 1">养殖中</span>
                    <van-button round class="u-bg-gradient-light order-status-btn" v-if="item.state == 3">确认发货</van-button>
                    <span class="order-status-text color-primary" v-if="item.state == 4">已完成</span>
                    <van-button round class="order-status-btn order-status-cancel" v-if="item.state == 99">已取消</van-button> -->
                </div>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    props: ['listData'],
    data() {
        return {
            currentListData: this.listData
        }
    },
    watch:{
        listData:function(newVal, oldVal){
            console.log('newVal:',newVal)
            this.currentlistData = newVal;
        }
    },
    methods: {
        jumpOrderDetail(item) {
            this.$router.push({
                path: '/my/supplyOrder/supplyOrderDetail/' + item.id,
            })
        }
    },
    mounted() {
        // console.log('currentListData:',this.currentListData)
        // this.getOrderDetail()
    }
}
</script>

<style lang="scss" scoped>
    .order-list-container {
        .common-order-list {
            width: 100%;
            padding: 0 16px 10px;
            box-sizing: border-box;
            li {
                width: 100%;
                margin-top: 10px;
                padding: 12px 12px 0;
                box-sizing: border-box;
                border-radius: 8px;
                background-color: #fff;
                .common-order-num {
                    margin-bottom: 16px;
                    font-size: 16px;
                    font-weight: 400;
                    color: #344047;
                }
                .common-order-info-list {
                    .common-order-info-list-top {
                        width: 100%;
                        padding-bottom: 14px;
                        box-sizing: border-box;
                        display: flex;
                        justify-content: space-between;
                        .common-order-img {
                            width: 80px;
                            height: 80px;
                            margin-right: 12px;
                            background-color: #f8f8f8;
                            border-radius: 8px;
                            overflow: hidden;
                            img {
                                width: 80px;
                                height: 80px;
                                object-fit: cover;
                            }
                        }
                        .common-order-info-details {
                            flex: 1;
                            .common-order-info-detail-item {
                                display: flex;
                                justify-content: space-between;
                                align-items: center;
                                margin-top: 10px;
                                color: #969C9E;
                                font-size: 12px;
                                span {
                                    display: block;
                                    // max-width: 50%;
                                }
                            }
                            .common-order-info-detail-item-other {
                                width: 226px;
                                margin-top: 2px;
                                font-size: 16px;
                                font-weight: 400;
                                color: #344047;
                                p {
                                    width: 100%;
                                    overflow: hidden;
                                    text-overflow: ellipsis;
                                    white-space: nowrap;
                                }
                            }
                            .common-order-info-detail-item-one {
                                width: 100%;
                                margin-top: 16px;
                                display: flex;
                                justify-content: space-between;
                                align-items: center;
                                p {
                                    font-size: 12px;
                                    color: #969C9E;
                                    span.color-yellow {
                                        position: relative;
                                        top: 1px;
                                        margin-right: 7px;
                                        font-size: 16px;
                                    }
                                }
                            }
                        }
                    }
                    .common-order-info-list-center {
                        padding-left: 92px;
                        box-sizing: border-box;
                        margin-bottom: 10px;
                        font-size: 12px;
                        color: #969C9E;
                        span {
                            position: relative;
                            top: 1.5px;
                            margin-right: 6px;
                            font-size: 16px;
                            color: #F58523;
                        }
                    }
                    .common-order-info-list-bottom {
                        width: 100%;
                        padding: 10px 0;
                        box-sizing: border-box;
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
                        font-size: 14px;
                        border-top: 1px solid #f2f2f2;
                        border-bottom: 1px solid #f2f2f2;
                    }
                }
                .common-order-info-bottom {
                    width: 100%;
                    padding: 12px 0;
                    box-sizing: border-box;
                    display: flex;
                    justify-content: flex-end;
                    align-items: center;
                    .common-order-info-bottom-left {
                        display: flex;
                        align-items: center;
                        flex: 1;
                        font-weight: 400;
                        p:first-child {
                            position: relative;
                            top: 1px;
                            margin-right: 24px;
                        }
                        p:last-child {
                            span {
                                font-size: 16px;
                            }
                        }
                    }
                    .order-status-btn {
                        min-width: 88px;
                        height: 34px;
                        line-height: 34px;
                        margin-left: 20px;
                        box-shadow: none;
                        font-size: 14px;
                        color: #fff;
                        border: none;
                    }
                    .order-status-cancel {
                        color: #969C9E;
                        border: 1px solid #969C9E;
                    }
                    .order-status-text {
                        width: 88px;
                        height: 34px;
                        line-height: 34px;
                        margin-left: 20px;
                        font-size: 16px;
                        text-align: right;
                    }
                }
            }
        }
    }
</style>